﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Model;
using NHibernate.IDAL;
using LYM.CommonWeb.DataServer;
using LYM.CommonWeb;
using System.Data;

namespace NHibernate.DAL
{
    public class Traning_LecturerDAL : ITraning_LecturerDAL
    {
        /// <summary>
        /// NHibernate分页查询
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<Traning_Lecturer> GetList(Traning_LecturerQuery query)
        {
            using (TemporaryContext context = new TemporaryContext())
            {
                var tb = context.Traning_Lecturer;
                tb = tb.Where(p => p.lecturerDetail == query.SortName);
                return PagingBase.Paging<Traning_Lecturer>(tb, query).ToList();
            }
        }
    }

    public class Traning_LecturerSQLDAL : ITraning_LecturerDAL
    {
        /// <summary>
        /// SQL分页查询
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<Traning_Lecturer> GetList(Traning_LecturerQuery query)
        {
            string whereStr = "";
            SQLTools tools = new SQLTools();
            tools.AddSqlParameter("uid", System.Data.SqlDbType.VarChar, 50, query.SortName);
            return PagingBase.Paging<Traning_Lecturer>("Traning_Lecturer", whereStr, query);
        }
    }
}
